package com.vincent.guava;

import java.util.Objects;

import org.testng.annotations.Test;

import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap;

public class BiMapTester {
	
	@Test(expectedExceptions = IllegalArgumentException.class)
	public void testBiMap() {
	 BiMap<Integer, String> biMap = HashBiMap.create();
	 biMap.put(1, "a");
	 biMap.put(2, "b");
	 System.out.println(Objects.toString(biMap));
	 biMap.put(3, "a"); // an exception
	} 
	
	@Test
	public void reverseBimap(){
		BiMap<Integer, String> biMap = HashBiMap.create();
		biMap.put(1, "a");
		biMap.put(2, "b");
		biMap.put(3, "c");
		 
		BiMap<String, Integer> invertedMap = biMap.inverse();
		
		System.out.println(Objects.toString(biMap));
		System.out.println(Objects.toString(invertedMap));
	}
}
